\(\int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx\) [671]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 39, antiderivative size = 54 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\frac {i a B x}{c}+\frac {a B \log (\cos (e+f x))}{c f}+\frac {a (A-i B)}{c f (i+\tan (e+f x))} \]

[Out]

I*a*B*x/c+a*B*ln(cos(f*x+e))/c/f+a*(A-I*B)/c/f/(I+tan(f*x+e))

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 45} \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\frac {a (A-i B)}{c f (\tan (e+f x)+i)}+\frac {a B \log (\cos (e+f x))}{c f}+\frac {i a B x}{c} \]

[In]

Int[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]),x]

[Out]

(I*a*B*x)/c + (a*B*Log[Cos[e + f*x]])/(c*f) + (a*(A - I*B))/(c*f*(I + Tan[e + f*x]))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int \frac {A+B x}{(c-i c x)^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a c) \text {Subst}\left (\int \left (\frac {-A+i B}{c^2 (i+x)^2}-\frac {B}{c^2 (i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {i a B x}{c}+\frac {a B \log (\cos (e+f x))}{c f}+\frac {a (A-i B)}{c f (i+\tan (e+f x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 2.24 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.81 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=-\frac {a \left (B \log (i+\tan (e+f x))-\frac {A-i B}{i+\tan (e+f x)}\right )}{c f} \]

[In]

Integrate[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x]),x]

[Out]

-((a*(B*Log[I + Tan[e + f*x]] - (A - I*B)/(I + Tan[e + f*x])))/(c*f))

Maple [A] (verified)

Time = 0.11 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.37

method result size
risch \(-\frac {{\mathrm e}^{2 i \left (f x +e \right )} a B}{2 c f}-\frac {i {\mathrm e}^{2 i \left (f x +e \right )} A a}{2 c f}-\frac {2 i B a e}{c f}+\frac {B a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{c f}\) \(74\)
derivativedivides \(-\frac {i a B}{f c \left (i+\tan \left (f x +e \right )\right )}+\frac {a A}{f c \left (i+\tan \left (f x +e \right )\right )}-\frac {a B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f c}+\frac {i a B \arctan \left (\tan \left (f x +e \right )\right )}{f c}\) \(83\)
default \(-\frac {i a B}{f c \left (i+\tan \left (f x +e \right )\right )}+\frac {a A}{f c \left (i+\tan \left (f x +e \right )\right )}-\frac {a B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f c}+\frac {i a B \arctan \left (\tan \left (f x +e \right )\right )}{f c}\) \(83\)
norman \(\frac {\frac {\left (-i a B +A a \right ) \tan \left (f x +e \right )}{c f}+\frac {i a B x}{c}+\frac {i a B x \tan \left (f x +e \right )^{2}}{c}-\frac {i A a +B a}{c f}}{1+\tan \left (f x +e \right )^{2}}-\frac {a B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f c}\) \(102\)

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

-1/2/c/f*exp(2*I*(f*x+e))*a*B-1/2*I/c/f*exp(2*I*(f*x+e))*A*a-2*I/c/f*B*a*e+1/c/f*B*a*ln(exp(2*I*(f*x+e))+1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.80 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\frac {{\left (-i \, A - B\right )} a e^{\left (2 i \, f x + 2 i \, e\right )} + 2 \, B a \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{2 \, c f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*((-I*A - B)*a*e^(2*I*f*x + 2*I*e) + 2*B*a*log(e^(2*I*f*x + 2*I*e) + 1))/(c*f)

Sympy [A] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.63 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\frac {B a \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c f} + \begin {cases} \frac {\left (- i A a e^{2 i e} - B a e^{2 i e}\right ) e^{2 i f x}}{2 c f} & \text {for}\: c f \neq 0 \\\frac {x \left (A a e^{2 i e} - i B a e^{2 i e}\right )}{c} & \text {otherwise} \end {cases} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x)

[Out]

B*a*log(exp(2*I*f*x) + exp(-2*I*e))/(c*f) + Piecewise(((-I*A*a*exp(2*I*e) - B*a*exp(2*I*e))*exp(2*I*f*x)/(2*c*
f), Ne(c*f, 0)), (x*(A*a*exp(2*I*e) - I*B*a*exp(2*I*e))/c, True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 123 vs. \(2 (48) = 96\).

Time = 0.39 (sec) , antiderivative size = 123, normalized size of antiderivative = 2.28 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\frac {\frac {B a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{c} - \frac {2 \, B a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c} + \frac {B a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{c} + \frac {3 \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 8 i \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 \, B a}{c {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{2}}}{f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

(B*a*log(tan(1/2*f*x + 1/2*e) + 1)/c - 2*B*a*log(tan(1/2*f*x + 1/2*e) + I)/c + B*a*log(tan(1/2*f*x + 1/2*e) -
1)/c + (3*B*a*tan(1/2*f*x + 1/2*e)^2 - 2*A*a*tan(1/2*f*x + 1/2*e) + 8*I*B*a*tan(1/2*f*x + 1/2*e) - 3*B*a)/(c*(
tan(1/2*f*x + 1/2*e) + I)^2))/f

Mupad [B] (verification not implemented)

Time = 8.86 (sec) , antiderivative size = 51, normalized size of antiderivative = 0.94 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx=\frac {\frac {A\,a}{c}-\frac {B\,a\,1{}\mathrm {i}}{c}}{f\,\left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )}-\frac {B\,a\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )}{c\,f} \]

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i))/(c - c*tan(e + f*x)*1i),x)

[Out]

((A*a)/c - (B*a*1i)/c)/(f*(tan(e + f*x) + 1i)) - (B*a*log(tan(e + f*x) + 1i))/(c*f)